#ifndef __KERNEL__
#define __KERNEL__
#include "Mailer.h"
#include "Scheduler.h"
#include "Node.h"
class Scheduler;
class Shell1;

class Kernel
{
	private:
		int i;
		Scheduler* scheduler;
		Mailer* mailer;
		Shell1* myShell;
		map<int,Node*> nodes;
		map<int,BoundedMailBox*> nodes_mailboxes;
		//static Kernel* m_instance;
		
	public:
		~Kernel();
		Kernel();
		Kernel(Shell1* shell);
		//static Kernel* getInstance();
		//static Kernel* getInstance(Shell* shell);
		//void updateShellsPointer(Shell* shell);
		void StartOS();
		int Send(int DestinationThreadID, Message* msg);
		Message* Receive(int RecieverID);
		int SendText (int fromNode, int toNode, char* text);
		int CrashNode(int NodeID);
		int ReviveNode(int NodeID);
		void ShowTable(int NodeID);
		bool Deadlock(int id);
		int KillAll();
		double Time();
		double Time(int NodeID);
		int Max_Length();
		int Max_Length(int NodeID);
		int CreateNet(char* Filename);
		int numofmessages(int id);
};

extern int ID;
#endif


